The present invention relates to a method and apparatus for optimizing a messaging parser for making runtime choices when parsing a message against a message model.
Message models provide a method for describing the logical structure of message data. A typical message model may be composed of both simple and complex elements, and either sequences or choices between said elements at different levels within the structure. A choice construct enables a developer to model a message such that a particular element (complex or simple) may be one of a plurality of element types. However, in the case of a choice of complex structures in order for the run-time to parse a message correctly then the run time will parse the structure as each of the plurality of possible structures in turn until it reaches the one that parses correctly. This can lead to excessive parsing and CPU cost.